package util;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

import javax.swing.JOptionPane;

import java.sql.Connection;
import java.sql.DriverManager;

public class GerenteConexao {
	
	static String driver = "com.mysql.jdbc.Driver";
	static String url = "jdbc:mysql://localhost:3306/cartorio";
	static String user = "root";
	static String passwd = "88124389";
	static Connection con;
	private static GerenteConexao instance;
	
private GerenteConexao(){
	
}
	
	public static GerenteConexao getInstance(){
		if (instance == null) {
			instance = new GerenteConexao();
		}
		return instance;
	}
	
	public Connection getConexao() throws SQLException{
	
	try {
		Class.forName(driver);
		con = DriverManager.getConnection(url, user, passwd);
		
	} catch (ClassNotFoundException erro) {
		JOptionPane.showMessageDialog(null, erro);
	}
		return con;
				
	}
}
